/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clases;

import java.awt.Color;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.Component;
import java.awt.Font;
import javax.swing.JTable;
import javax.swing.SwingConstants;

/**
 *
 * @author Rolando
 */
public class ClsRenderTabla extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int column) {
        //setEnabled(table == null || table.isEnabled());
        //setBackground(Color.white);//color de fondo

        //si la celda esta vacia se reemplaza por el texto "<vacio>" y se rellena la celda de color negro y fuente color blanco
        setHorizontalAlignment(SwingConstants.LEFT);//centro
        
        /*--------*/
        if(column==6){
            setHorizontalAlignment(SwingConstants.RIGHT);//centro
        }
        
        if (String.valueOf(table.getValueAt(row, 9)).trim().equals("1")) {
            //setBackground(Color.PINK);
            //setFont(null);
            //setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
//            setHorizontalAlignment(SwingConstants.RIGHT);//centro
            Component comp = super.getTableCellRendererComponent(table, value, selected, focused, row, column);
            comp.setFont(new Font("Tahoma", Font.BOLD, 12));
//            if(column==6){
//              comp.setHorizontalAlignment(4); 
//            }
//            comp.setForeground(new java.awt.Color(0, 121, 249));
            return comp;
        } else {

            // replace default font
           // setFont(new Font("Tahoma", Font.BOLD, 11));
            // setBackground(Color.PINK);
            //
        }

        //si la celda contiene números
        super.getTableCellRendererComponent(table, value, selected, focused, row, column);
        return this;
    }
}